﻿using AntDesign;
using lcwb.Shared.Model;
namespace lcwb.Shared.Service
{
    public class NoteDrawerService
    {
        public MessageService Message;
        public NoteDrawerService(MessageService Message)
        {
            this.Message = Message;
        }
        

        public Note CurrentNote { get; private set; } = new();
        public bool IsVisible { get; private set; }
        public bool IsBasicStep { get; private set; } = true;

        public event Action OnChange;

        public void Show()
        {
            CurrentNote = new Note();
            IsBasicStep = true;
            IsVisible = true;
            NotifyStateChange();
        }

        public void NextStep()
        {
            IsBasicStep = false;
            NotifyStateChange();
        }
        public void ResetStep()
        {
            IsBasicStep = true;
            NotifyStateChange();
        }
        public async Task NoteFinished()
        {
            await Message.Success("保存成功");
            NotifyStateChange();
        }
        public void Close()
        {
            IsVisible = false;
            NotifyStateChange();
        }

        private void NotifyStateChange() => OnChange?.Invoke();
    }
}
